home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Source Code / C / Applications / Portable Patmos / src / portable kernel / mac / fcntl.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-24  |  662 b   |  27 lines  |  [TEXT/KAHL]

  1. #include <fcntl.h>
  2. #include <stdarg.h>
  3. #include <sys/types.h>
  4.  
  5. void kprintf(char *, ...);
  6.  
  7. extern int debug;
  8.  
  9. int fcntl(int fd, int cmd, ...)
  10.      {
  11.      int arg;
  12.      va_list args;
  13.      va_start(args, cmd);
  14.      arg = va_arg(args, int);
  15.      mysleep(1);
  16.      switch(cmd)
  17.          {
  18.          case F_DUPFD : return dup2(fd, next_fd(arg)); break;
  19.          case F_SETFD : if (debug) kprintf("Set fd flags\n"); return 0;
  20.         case F_GETFL : if (debug) kprintf("Get file status flags\n"); return O_RDWR; /* dummy */
  21.         case F_SETFL : if (debug) kprintf("Set file status flags\n"); return 0;
  22.          default: kprintf("Unsupported fcntl cmd %d\n", cmd);
  23.          }
  24.      return -1;
  25.      }
  26.     
  27.